Skip to content

Adding code to call the rag_api simple reranker.#33

Open
kalaspuffar wants to merge 3 commits intodanny-avila:mainfrom
kalaspuffar:simple_reranker
Open

Adding code to call the rag_api simple reranker.#33
kalaspuffar wants to merge 3 commits intodanny-avila:mainfrom
kalaspuffar:simple_reranker

Conversation

@kalaspuffar
Copy link
Copy Markdown

This code will call the simple reranker using local models in rag_api
danny-avila/rag_api#190

This is code to solve the issue I mentioned in:
danny-avila/LibreChat#9102

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request adds support for a new "simple" reranker type that integrates with the rag_api's local model-based reranking service. The implementation follows the existing pattern of reranker classes (Jina, Cohere, Infinity) but introduces JWT-based authentication for calling the Simple reranker API.

Key changes:

  • Adds SimpleReranker class that uses JWT authentication to call a local reranking service
  • Extends the RerankerType union to include 'simple' as a new option
  • Adds dependencies for jsonwebtoken package and its type definitions

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
src/tools/search/types.ts Adds 'simple' to the RerankerType union and adds simpleRerankerInstanceUrl configuration parameter
src/tools/search/tool.ts Threads the simpleRerankerInstanceUrl config parameter through to reranker creation
src/tools/search/rerankers.ts Implements SimpleReranker class with JWT authentication, adds it to the factory function, and applies code formatting improvements
package.json Adds jsonwebtoken runtime dependency and @types/jsonwebtoken dev dependency

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

Comment thread src/tools/search/rerankers.ts Outdated
Comment thread src/tools/search/rerankers.ts Outdated
Comment thread src/tools/search/rerankers.ts Outdated
Comment thread src/tools/search/rerankers.ts
@kalaspuffar kalaspuffar force-pushed the simple_reranker branch 4 times, most recently from f7a1163 to dc7db86 Compare December 3, 2025 22:15
@kalaspuffar kalaspuffar force-pushed the simple_reranker branch 2 times, most recently from 8673eef to 740642a Compare December 11, 2025 07:09
@danny-avila danny-avila requested a review from Copilot December 15, 2025 17:49
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/tools/search/simple-reranker.test.ts Outdated
Comment thread src/tools/search/rerankers.ts Outdated
Comment thread src/tools/search/rerankers.ts
@kalaspuffar
Copy link
Copy Markdown
Author

https://github.com/apps/copilot-pull-request-reviewer AI
[2 weeks ago](https://github.com/danny-avila/agents/pull/33#discussion_r2572100957)
The error message incorrectly states "Defaulting to InfinityReranker" but the code actually creates a JinaReranker instance. This message should be corrected to match the actual behavior:

Copilot suggested this change then forgot it.

kalaspuffar and others added 3 commits January 21, 2026 18:44
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
danny-avila added a commit that referenced this pull request May 5, 2026
…urns at end-of-Run (Codex P1 #32, P2 #33)

P1 #32: my round-7 wiring nulled \`_fileCheckpointer\` in
\`Graph.clearHeavyState\` — but \`Run.processStream()\` calls
\`clearHeavyState\` in its finally block on natural-completion AND
error paths, exactly when the host most needs to call
\`Run.rewindFiles()\` for rollback. The fix:

  1. Drop the \`this._fileCheckpointer = undefined\` line. Per-Run
     isolation is automatic because each \`Run.create()\` constructs
     a brand-new Graph instance.

  2. Update \`getOrCreateFileCheckpointer\` to return the cached
     instance unconditionally if present. Without this, the
     toolExecution-engine guard inside the accessor would reject
     the cached checkpointer once \`clearHeavyState\` nulled
     toolExecution.

P2 #33: the \`directPathTurns\` map I added in #30 to make
direct-path turns resume-stable was never cleared, so it grew
linearly with tool calls AND would have returned stale slots if a
provider reused call IDs across turns. Added:

  - \`ToolNode.clearDirectPathTurns()\` public method (\`@internal\`
    by convention but exposed for hosts that reuse a ToolNode
    outside a Graph).

  - \`Graph._compiledToolNodes\` set populated via
    \`registerCompiledToolNode()\` from each
    \`StandardGraph.initializeTools\` ToolNode construction site.

  - \`clearHeavyState\` iterates the set and calls
    \`clearDirectPathTurns()\` on each, then drops the set itself.

End-of-Run is the right boundary: directPathTurns is used during
hook lifecycle / runTool execution, never read post-run, so
clearing it there doesn't conflict with the checkpointer's
opposite requirement (which now survives clearHeavyState).

Tests pinned: \`checkpointer survives Graph.clearHeavyState so
post-completion rewind works (Codex P1 #32)\` exercises the round-
trip through the same cleanup the host hits, and
\`clearDirectPathTurns() empties the per-Run cache (Codex P2 #33)\`
pins the method directly. 808 tests passing across all suites.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants